package com.ld.admin.model.system.systeminfo.server;

import com.ld.shieldsb.common.core.util.ArithUtil;

import lombok.Data;

/**
 * CPU相关信息
 * 
 */
@Data
public class CpuInfo {

    /**
     * cpu名称
     */
    private String cpuName;

    /**
     * 核心数
     */
    private int cpuNum;

    /**
     * CPU总的使用率
     */
    private double total;

    /**
     * CPU系统使用率
     */
    private double sys;

    /**
     * CPU用户使用率
     */
    private double used;

    /**
     * CPU当前等待率
     */
    private double wait;

    /**
     * CPU当前空闲率
     */
    private double free;

    /**
     * 进程数
     */
    private int processCount;

    /**
     * 线程数
     */
    private int threadCount;

    public double getTotal() {

        return ArithUtil.round(ArithUtil.mul(total, 100), 2);
    }

    public double getSys() {
        return ArithUtil.round(ArithUtil.mul(sys / total, 100), 2);
    }

    public double getUsed() {
        return ArithUtil.round(ArithUtil.mul(used / total, 100), 2);
    }

    public double getWait() {
        return ArithUtil.round(ArithUtil.mul(wait / total, 100), 2);
    }

    public double getFree() {
        return ArithUtil.round(ArithUtil.mul(free / total, 100), 2);
    }

}
